package plugins.flavours;

import plugins.Plugin;
import main.Room;
import main.User;

public class RollPlugin extends Plugin {

   private static final int MAX = 100;
   
   @Override
   public void execute(Room room, User user, String command, String text) {
      int max = MAX;
      try {
         int x = Integer.parseInt(text);
         max = x;
      } catch(NumberFormatException nFE) {
         
      }
      int roll = (int) (Math.random() * max + 1);
      room.dispatchRoomMsg(user.name + " rolled " + roll + " (out of " + max + ")");
   }

}
